home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / extensions / nsIExtensionManager.h
C/C++ Source or Header  |  2006-05-08  |  54KB  |  1,309 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIExtensionManager.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIExtensionManager_h__
  6. #define __gen_nsIExtensionManager_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIFile; /* forward declaration */
  18.  
  19. class nsIRDFDataSource; /* forward declaration */
  20.  
  21. class nsIUpdateItem; /* forward declaration */
  22.  
  23. class nsIAddonUpdateListener; /* forward declaration */
  24.  
  25. class nsIAddonUpdateCheckListener; /* forward declaration */
  26.  
  27. class nsICommandLine; /* forward declaration */
  28.  
  29. class nsISimpleEnumerator; /* forward declaration */
  30.  
  31. class nsIDirectoryEnumerator; /* forward declaration */
  32.  
  33.  
  34. /* starting interface:    nsIInstallLocation */
  35. #define NS_IINSTALLLOCATION_IID_STR "d3d4dada-c6eb-11d9-a68f-001124787b2e"
  36.  
  37. #define NS_IINSTALLLOCATION_IID \
  38.   {0xd3d4dada, 0xc6eb, 0x11d9, \
  39.     { 0xa6, 0x8f, 0x00, 0x11, 0x24, 0x78, 0x7b, 0x2e }}
  40.  
  41. /**
  42.  * Interface representing a location where extensions, themes etc are 
  43.  * installed.
  44.  */
  45. class NS_NO_VTABLE nsIInstallLocation : public nsISupports {
  46.  public: 
  47.  
  48.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IINSTALLLOCATION_IID)
  49.  
  50.   /**
  51.    * The string identifier of this Install Location
  52.    */
  53.   /* readonly attribute AString name; */
  54.   NS_IMETHOD GetName(nsAString & aName) = 0;
  55.  
  56.   /**
  57.    * An enumeration of nsIFiles for:
  58.    * - locations that contain items
  59.    * - potential dropped-in XPIs
  60.    * Note: This enumeration resolves Text Links to the directories they
  61.    *       refer to.
  62.    */
  63.   /* readonly attribute nsIDirectoryEnumerator itemLocations; */
  64.   NS_IMETHOD GetItemLocations(nsIDirectoryEnumerator * *aItemLocations) = 0;
  65.  
  66.   /**
  67.    * The file system location where items live. Items can be dropped in
  68.    * at this location. Can be null for Install Locations that don't have
  69.    * a file system presence. 
  70.    * Note: This is a clone of the actual location which the caller can 
  71.    *       modify freely.
  72.    */
  73.   /* readonly attribute nsIFile location; */
  74.   NS_IMETHOD GetLocation(nsIFile * *aLocation) = 0;
  75.  
  76.   /**
  77.    * Whether or not this Install Location is on an area of the file system
  78.    * that could be restricted on a restricted-access account, regardless
  79.    * of whether or not the location is restricted with the current user
  80.    * privileges. 
  81.    */
  82.   /* readonly attribute boolean restricted; */
  83.   NS_IMETHOD GetRestricted(PRBool *aRestricted) = 0;
  84.  
  85.   /**
  86.    * Whether or not the user can write to the Install Location with the
  87.    * current access privileges. This is different from restricted because
  88.    * it's not whether or not the location *might* be restricted, it's 
  89.    * whether or not it actually *is* restricted right now.
  90.    */
  91.   /* readonly attribute boolean canAccess; */
  92.   NS_IMETHOD GetCanAccess(PRBool *aCanAccess) = 0;
  93.  
  94.   /**
  95.    * Constants representing priority of some default Install Locations.
  96.    * XXXben - priority ranking of user-level items vs. global-level items
  97.    *          here is debatable. Should app-system-global trump 
  98.    *          xre-system-user?
  99.    * You should not use the exact values here, you should offset from
  100.    * these values each time you create a new Install Location. Offsetting
  101.    * can be brittle but you should know what Install Locations are being
  102.    * defined for your own application.
  103.    */
  104.   enum { PRIORITY_APP_PROFILE = 0U };
  105.  
  106.   enum { PRIORITY_APP_SYSTEM_USER = 10U };
  107.  
  108.   enum { PRIORITY_XRE_SYSTEM_USER = 100U };
  109.  
  110.   enum { PRIORITY_APP_SYSTEM_GLOBAL = 1000U };
  111.  
  112.   enum { PRIORITY_XRE_SYSTEM_GLOBAL = 10000U };
  113.  
  114.   /**
  115.    * The priority level of this Install Location in loading. 
  116.    */
  117.   /* readonly attribute long priority; */
  118.   NS_IMETHOD GetPriority(PRInt32 *aPriority) = 0;
  119.  
  120.   /**
  121.    * Gets the directory that contains an item.
  122.    * @param   id
  123.    *          The GUID of the item.
  124.    * @returns The location of the item. 
  125.    */
  126.   /* nsIFile getItemLocation (in AString id); */
  127.   NS_IMETHOD GetItemLocation(const nsAString & id, nsIFile **_retval) = 0;
  128.  
  129.   /**
  130.    * Retrieves the GUID for an item at the specified location.
  131.    * @param   file
  132.    *          The location where an item might live.
  133.    * @returns The ID for an item that might live at the location specified.
  134.    *
  135.    * N.B. This function makes no promises about whether or not this path is
  136.    *      actually maintained by this Install Location.
  137.    */
  138.   /* AString getIDForLocation (in nsIFile file); */
  139.   NS_IMETHOD GetIDForLocation(nsIFile *file, nsAString & _retval) = 0;
  140.  
  141.   /**
  142.    * Gets a nsIFile object for a file within an item's directory structure.
  143.    * @param   id
  144.    *          The GUID of the item.
  145.    * @param   path
  146.    *          The path to the file beneath an Extension's directory
  147.    * @returns A file object at the requested location. The file does not
  148.    *          necessarily have to exist.
  149.    */
  150.   /* nsIFile getItemFile (in AString id, in AString path); */
  151.   NS_IMETHOD GetItemFile(const nsAString & id, const nsAString & path, nsIFile **_retval) = 0;
  152.  
  153.   /**
  154.    * Determines whether or not an item's resources are managed by the Extension
  155.    * System or by some other user or process. For example, items linked to by
  156.    * text links are managed by the user, and items linked to from Registry
  157.    * Install Locations are usually managed by other applications or installers.
  158.    *
  159.    * @param   id
  160.    *          The GUID of the item.
  161.    * @returns true if the item's resources are managed independently of the
  162.    *          Extension System, false otherwise.
  163.    */
  164.   /* boolean itemIsManagedIndependently (in AString id); */
  165.   NS_IMETHOD ItemIsManagedIndependently(const nsAString & id, PRBool *_retval) = 0;
  166.  
  167. };
  168.  
  169. /* Use this macro when declaring classes that implement this interface. */
  170. #define NS_DECL_NSIINSTALLLOCATION \
  171.   NS_IMETHOD GetName(nsAString & aName); \
  172.   NS_IMETHOD GetItemLocations(nsIDirectoryEnumerator * *aItemLocations); \
  173.   NS_IMETHOD GetLocation(nsIFile * *aLocation); \
  174.   NS_IMETHOD GetRestricted(PRBool *aRestricted); \
  175.   NS_IMETHOD GetCanAccess(PRBool *aCanAccess); \
  176.   NS_IMETHOD GetPriority(PRInt32 *aPriority); \
  177.   NS_IMETHOD GetItemLocation(const nsAString & id, nsIFile **_retval); \
  178.   NS_IMETHOD GetIDForLocation(nsIFile *file, nsAString & _retval); \
  179.   NS_IMETHOD GetItemFile(const nsAString & id, const nsAString & path, nsIFile **_retval); \
  180.   NS_IMETHOD ItemIsManagedIndependently(const nsAString & id, PRBool *_retval); 
  181.  
  182. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  183. #define NS_FORWARD_NSIINSTALLLOCATION(_to) \
  184.   NS_IMETHOD GetName(nsAString & aName) { return _to GetName(aName); } \
  185.   NS_IMETHOD GetItemLocations(nsIDirectoryEnumerator * *aItemLocations) { return _to GetItemLocations(aItemLocations); } \
  186.   NS_IMETHOD GetLocation(nsIFile * *aLocation) { return _to GetLocation(aLocation); } \
  187.   NS_IMETHOD GetRestricted(PRBool *aRestricted) { return _to GetRestricted(aRestricted); } \
  188.   NS_IMETHOD GetCanAccess(PRBool *aCanAccess) { return _to GetCanAccess(aCanAccess); } \
  189.   NS_IMETHOD GetPriority(PRInt32 *aPriority) { return _to GetPriority(aPriority); } \
  190.   NS_IMETHOD GetItemLocation(const nsAString & id, nsIFile **_retval) { return _to GetItemLocation(id, _retval); } \
  191.   NS_IMETHOD GetIDForLocation(nsIFile *file, nsAString & _retval) { return _to GetIDForLocation(file, _retval); } \
  192.   NS_IMETHOD GetItemFile(const nsAString & id, const nsAString & path, nsIFile **_retval) { return _to GetItemFile(id, path, _retval); } \
  193.   NS_IMETHOD ItemIsManagedIndependently(const nsAString & id, PRBool *_retval) { return _to ItemIsManagedIndependently(id, _retval); } 
  194.  
  195. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  196. #define NS_FORWARD_SAFE_NSIINSTALLLOCATION(_to) \
  197.   NS_IMETHOD GetName(nsAString & aName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetName(aName); } \
  198.   NS_IMETHOD GetItemLocations(nsIDirectoryEnumerator * *aItemLocations) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetItemLocations(aItemLocations); } \
  199.   NS_IMETHOD GetLocation(nsIFile * *aLocation) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLocation(aLocation); } \
  200.   NS_IMETHOD GetRestricted(PRBool *aRestricted) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRestricted(aRestricted); } \
  201.   NS_IMETHOD GetCanAccess(PRBool *aCanAccess) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCanAccess(aCanAccess); } \
  202.   NS_IMETHOD GetPriority(PRInt32 *aPriority) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPriority(aPriority); } \
  203.   NS_IMETHOD GetItemLocation(const nsAString & id, nsIFile **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetItemLocation(id, _retval); } \
  204.   NS_IMETHOD GetIDForLocation(nsIFile *file, nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIDForLocation(file, _retval); } \
  205.   NS_IMETHOD GetItemFile(const nsAString & id, const nsAString & path, nsIFile **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetItemFile(id, path, _retval); } \
  206.   NS_IMETHOD ItemIsManagedIndependently(const nsAString & id, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ItemIsManagedIndependently(id, _retval); } 
  207.  
  208. #if 0
  209. /* Use the code below as a template for the implementation class for this interface. */
  210.  
  211. /* Header file */
  212. class nsInstallLocation : public nsIInstallLocation
  213. {
  214. public:
  215.   NS_DECL_ISUPPORTS
  216.   NS_DECL_NSIINSTALLLOCATION
  217.  
  218.   nsInstallLocation();
  219.  
  220. private:
  221.   ~nsInstallLocation();
  222.  
  223. protected:
  224.   /* additional members */
  225. };
  226.  
  227. /* Implementation file */
  228. NS_IMPL_ISUPPORTS1(nsInstallLocation, nsIInstallLocation)
  229.  
  230. nsInstallLocation::nsInstallLocation()
  231. {
  232.   /* member initializers and constructor code */
  233. }
  234.  
  235. nsInstallLocation::~nsInstallLocation()
  236. {
  237.   /* destructor code */
  238. }
  239.  
  240. /* readonly attribute AString name; */
  241. NS_IMETHODIMP nsInstallLocation::GetName(nsAString & aName)
  242. {
  243.     return NS_ERROR_NOT_IMPLEMENTED;
  244. }
  245.  
  246. /* readonly attribute nsIDirectoryEnumerator itemLocations; */
  247. NS_IMETHODIMP nsInstallLocation::GetItemLocations(nsIDirectoryEnumerator * *aItemLocations)
  248. {
  249.     return NS_ERROR_NOT_IMPLEMENTED;
  250. }
  251.  
  252. /* readonly attribute nsIFile location; */
  253. NS_IMETHODIMP nsInstallLocation::GetLocation(nsIFile * *aLocation)
  254. {
  255.     return NS_ERROR_NOT_IMPLEMENTED;
  256. }
  257.  
  258. /* readonly attribute boolean restricted; */
  259. NS_IMETHODIMP nsInstallLocation::GetRestricted(PRBool *aRestricted)
  260. {
  261.     return NS_ERROR_NOT_IMPLEMENTED;
  262. }
  263.  
  264. /* readonly attribute boolean canAccess; */
  265. NS_IMETHODIMP nsInstallLocation::GetCanAccess(PRBool *aCanAccess)
  266. {
  267.     return NS_ERROR_NOT_IMPLEMENTED;
  268. }
  269.  
  270. /* readonly attribute long priority; */
  271. NS_IMETHODIMP nsInstallLocation::GetPriority(PRInt32 *aPriority)
  272. {
  273.     return NS_ERROR_NOT_IMPLEMENTED;
  274. }
  275.  
  276. /* nsIFile getItemLocation (in AString id); */
  277. NS_IMETHODIMP nsInstallLocation::GetItemLocation(const nsAString & id, nsIFile **_retval)
  278. {
  279.     return NS_ERROR_NOT_IMPLEMENTED;
  280. }
  281.  
  282. /* AString getIDForLocation (in nsIFile file); */
  283. NS_IMETHODIMP nsInstallLocation::GetIDForLocation(nsIFile *file, nsAString & _retval)
  284. {
  285.     return NS_ERROR_NOT_IMPLEMENTED;
  286. }
  287.  
  288. /* nsIFile getItemFile (in AString id, in AString path); */
  289. NS_IMETHODIMP nsInstallLocation::GetItemFile(const nsAString & id, const nsAString & path, nsIFile **_retval)
  290. {
  291.     return NS_ERROR_NOT_IMPLEMENTED;
  292. }
  293.  
  294. /* boolean itemIsManagedIndependently (in AString id); */
  295. NS_IMETHODIMP nsInstallLocation::ItemIsManagedIndependently(const nsAString & id, PRBool *_retval)
  296. {
  297.     return NS_ERROR_NOT_IMPLEMENTED;
  298. }
  299.  
  300. /* End of implementation class template. */
  301. #endif
  302.  
  303.  
  304. /* starting interface:    nsIExtensionManager */
  305. #define NS_IEXTENSIONMANAGER_IID_STR "a3f5396c-a6e8-414a-8fbc-c8d831746328"
  306.  
  307. #define NS_IEXTENSIONMANAGER_IID \
  308.   {0xa3f5396c, 0xa6e8, 0x414a, \
  309.     { 0x8f, 0xbc, 0xc8, 0xd8, 0x31, 0x74, 0x63, 0x28 }}
  310.  
  311. /**
  312.  * Interface representing a system for the installation and management of
  313.  * Extensions, Themes etc. 
  314.  *
  315.  * XXXben - Some of this stuff should go into a management-ey interface, 
  316.  *          some into an app-startup-ey interface.
  317.  */
  318. class NS_NO_VTABLE nsIExtensionManager : public nsISupports {
  319.  public: 
  320.  
  321.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IEXTENSIONMANAGER_IID)
  322.  
  323.   /**
  324.    * Starts the Extension Manager, checking for item changes, additions and
  325.    * removals, and finishing pending operations.
  326.    * @param   commandLine
  327.    *          The command line the application was started with.
  328.    * @returns true if the application has rewritten the extensions.ini file
  329.    *          and needs to restart to register components/chrome etc, 
  330.    *          false otherwise
  331.    */
  332.   /* boolean start (in nsICommandLine commandLine); */
  333.   NS_IMETHOD Start(nsICommandLine *commandLine, PRBool *_retval) = 0;
  334.  
  335.   /** 
  336.    * Determines if there are incompatible items installed (and offers to
  337.    * upgrade them to newer versions if available, via a UI). 
  338.    * @returns true if there were incompatible items that were disabled
  339.    *          and the application needs to restart to re-register components,
  340.    *          chrome etc, false otherwise.
  341.    */
  342.   /* boolean checkForMismatches (); */
  343.   NS_IMETHOD CheckForMismatches(PRBool *_retval) = 0;
  344.  
  345.   /**
  346.    * Handle command line flags, e.g. -install-global-[extension|theme]
  347.    * @param   cmdLine
  348.    *          the command line the application was started with
  349.    * XXXben - move this off this API - currently it is only used for 
  350.    *          global installation, and the apprunner can do this directly
  351.    *          with |installItemFromFile|
  352.    */
  353.   /* void handleCommandLineArgs (in nsICommandLine cmdline); */
  354.   NS_IMETHOD HandleCommandLineArgs(nsICommandLine *cmdline) = 0;
  355.  
  356.   /**
  357.    * Gets the Install Location for an item
  358.    * @param   id
  359.    *          The GUID of the item
  360.    * @returns The Install Location where the item is installed.
  361.    */
  362.   /* nsIInstallLocation getInstallLocation (in AString id); */
  363.   NS_IMETHOD GetInstallLocation(const nsAString & id, nsIInstallLocation **_retval) = 0;
  364.  
  365.   /**
  366.    * An enumeration of all registered Install Items
  367.    */
  368.   /* readonly attribute nsISimpleEnumerator installLocations; */
  369.   NS_IMETHOD GetInstallLocations(nsISimpleEnumerator * *aInstallLocations) = 0;
  370.  
  371.   /**
  372.    * Installs an item from a XPI/JAR file into the location specified. 
  373.    * @param   xpiFile
  374.    *          The source file to install from. This function stages a copy
  375.    *          of this file for persistence across potential application 
  376.    *          restarts, you are responsible for removing the file you pass
  377.    *          in. 
  378.    * @param   installLocationKey
  379.    *          The name identifier of an Install Location to install into.
  380.    */
  381.   /* void installItemFromFile (in nsIFile xpiFile, in AString installLocationKey); */
  382.   NS_IMETHOD InstallItemFromFile(nsIFile *xpiFile, const nsAString & installLocationKey) = 0;
  383.  
  384.   /**
  385.    * Uninstalls an item
  386.    * @param   id
  387.    *          The GUID of the item.
  388.    */
  389.   /* void uninstallItem (in AString id); */
  390.   NS_IMETHOD UninstallItem(const nsAString & id) = 0;
  391.  
  392.   /**
  393.    * Enables a disabled item
  394.    * @param   id
  395.    *          The GUID of the item.
  396.    */
  397.   /* void enableItem (in AString id); */
  398.   NS_IMETHOD EnableItem(const nsAString & id) = 0;
  399.  
  400.   /**
  401.    * Disables an enabled item
  402.    * @param   id
  403.    *          The GUID of the item.
  404.    */
  405.   /* void disableItem (in AString id); */
  406.   NS_IMETHOD DisableItem(const nsAString & id) = 0;
  407.  
  408.   /**
  409.    * Checks for updates to a list of items.
  410.    * @param   items
  411.    *          An array of nsIUpdateItems to check for updates for.
  412.    * @param   itemCount
  413.    *          The length of |items|
  414.    * @param   versionUpdateOnly
  415.    *          false if this check should find the newest versions available,
  416.    *          true if it should only find newer target application compatibility
  417.    *          information for the currently installed version.
  418.    *          2 if this check should only find target application compatibility
  419.    *          information for the currently installed version and synchronize
  420.    *          the values.
  421.    * @param   listener
  422.    *          An nsIAddonUpdateCheckListener object which will be notified during
  423.    *          the update check process. 
  424.    */
  425.   /* void update ([array, size_is (itemCount)] in nsIUpdateItem items, in unsigned long itemCount, in unsigned long versionUpdateOnly, in nsIAddonUpdateCheckListener listener); */
  426.   NS_IMETHOD Update(nsIUpdateItem **items, PRUint32 itemCount, PRUint32 versionUpdateOnly, nsIAddonUpdateCheckListener *listener) = 0;
  427.  
  428.   /**
  429.    * Gets a nsIUpdateItem for the item with the specified id.
  430.    * @param   id
  431.    *          The GUID of the item to construct a nsIUpdateItem for.
  432.    * @returns The nsIUpdateItem representing the item.
  433.    */
  434.   /* nsIUpdateItem getItemForID (in AString id); */
  435.   NS_IMETHOD GetItemForID(const nsAString & id, nsIUpdateItem **_retval) = 0;
  436.  
  437.   /**
  438.    * Retrieves a list of visible nsIUpdateItems of items matching the 
  439.    * specified type.
  440.    * @param   type
  441.    *          The type of item to return.
  442.    * @param   countRef
  443.    *          The XPCJS reference to the number of items returned.
  444.    * @returns An array of nsIUpdateItems matching the id/type filter.
  445.    *
  446.    * XXXben - it would be good if this function took an optional 
  447.    *          install location.
  448.    */
  449.   /* void getItemList (in unsigned long type, out unsigned long itemCount, [array, size_is (itemCount), retval] out nsIUpdateItem items); */
  450.   NS_IMETHOD GetItemList(PRUint32 type, PRUint32 *itemCount, nsIUpdateItem ***items) = 0;
  451.  
  452.   /**
  453.    * Retrieves a list of nsIUpdateItems of items that are incompatible
  454.    * with the supplied parameters.
  455.    * @param   id
  456.    *          The id of the application to check compatibility against
  457.    * @param   version
  458.    *          The version of the application to check compatibility against
  459.    * @param   type
  460.    *          The type of item to return
  461.    * @param   includeDisabled
  462.    *          true if disabled items should be included in the result set, 
  463.    *          false otherwise
  464.    * @param   countRef
  465.    *          The XPCJS reference to the number of items returned.
  466.    * @returns An array of incompatible nsIUpdateItems.
  467.    */
  468.   /* void getIncompatibleItemList (in AString id, in AString version, in unsigned long type, in boolean includeDisabled, out unsigned long itemCount, [array, size_is (itemCount), retval] out nsIUpdateItem items); */
  469.   NS_IMETHOD GetIncompatibleItemList(const nsAString & id, const nsAString & version, PRUint32 type, PRBool includeDisabled, PRUint32 *itemCount, nsIUpdateItem ***items) = 0;
  470.  
  471.   /**
  472.    * The Extensions Datasource
  473.    * XXXben - the datasource should be registered with the RDF system, so it 
  474.    *          can be accessed via rdf:extensions, and not exposed through the API
  475.    *          like this.
  476.    */
  477.   /* readonly attribute nsIRDFDataSource datasource; */
  478.   NS_IMETHOD GetDatasource(nsIRDFDataSource * *aDatasource) = 0;
  479.  
  480.   /**
  481.    * Adds active download entries to the UI
  482.    * @param   items
  483.    *          A list of nsIUpdateItems to entries to add
  484.    * @param   itemCount
  485.    *          The length of |items|
  486.    * @param   fromChrome
  487.    *          true when called from chrome
  488.    *          false when not called from chrome (e.g. web page)
  489.    */
  490.   /* void addDownloads ([array, size_is (itemCount)] in nsIUpdateItem items, in unsigned long itemCount, in boolean fromChrome); */
  491.   NS_IMETHOD AddDownloads(nsIUpdateItem **items, PRUint32 itemCount, PRBool fromChrome) = 0;
  492.  
  493.   /**
  494.    * Removes an active download from the UI
  495.    * @param   url
  496.    *          The URL of the active download to remove
  497.    */
  498.   /* void removeDownload (in AString url); */
  499.   NS_IMETHOD RemoveDownload(const nsAString & url) = 0;
  500.  
  501.   /**
  502.    * Adds a download progress listener so the front end can listen to download
  503.    * and install progress.
  504.    * @param   listener
  505.    *          The listener to add
  506.    * @returns the index of the added listen in the listener list. 
  507.    */
  508.   /* long addUpdateListener (in nsIAddonUpdateListener listener); */
  509.   NS_IMETHOD AddUpdateListener(nsIAddonUpdateListener *listener, PRInt32 *_retval) = 0;
  510.  
  511.   /**
  512.    * Removes a download progress listener.
  513.    * @param   index
  514.    *          The index of the listener to remove.
  515.    */
  516.   /* void removeUpdateListenerAt (in long index); */
  517.   NS_IMETHOD RemoveUpdateListenerAt(PRInt32 index) = 0;
  518.  
  519.   /**
  520.    * Move an Item to the index of another item in its container.
  521.    * @param   movingID
  522.    *          The ID of an item to be moved.
  523.    * @param   destinationID
  524.    *          The ID of an item to move an item to.
  525.    */
  526.   /* void moveToIndexOf (in AString movingID, in AString destinationID); */
  527.   NS_IMETHOD MoveToIndexOf(const nsAString & movingID, const nsAString & destinationID) = 0;
  528.  
  529. };
  530.  
  531. /* Use this macro when declaring classes that implement this interface. */
  532. #define NS_DECL_NSIEXTENSIONMANAGER \
  533.   NS_IMETHOD Start(nsICommandLine *commandLine, PRBool *_retval); \
  534.   NS_IMETHOD CheckForMismatches(PRBool *_retval); \
  535.   NS_IMETHOD HandleCommandLineArgs(nsICommandLine *cmdline); \
  536.   NS_IMETHOD GetInstallLocation(const nsAString & id, nsIInstallLocation **_retval); \
  537.   NS_IMETHOD GetInstallLocations(nsISimpleEnumerator * *aInstallLocations); \
  538.   NS_IMETHOD InstallItemFromFile(nsIFile *xpiFile, const nsAString & installLocationKey); \
  539.   NS_IMETHOD UninstallItem(const nsAString & id); \
  540.   NS_IMETHOD EnableItem(const nsAString & id); \
  541.   NS_IMETHOD DisableItem(const nsAString & id); \
  542.   NS_IMETHOD Update(nsIUpdateItem **items, PRUint32 itemCount, PRUint32 versionUpdateOnly, nsIAddonUpdateCheckListener *listener); \
  543.   NS_IMETHOD GetItemForID(const nsAString & id, nsIUpdateItem **_retval); \
  544.   NS_IMETHOD GetItemList(PRUint32 type, PRUint32 *itemCount, nsIUpdateItem ***items); \
  545.   NS_IMETHOD GetIncompatibleItemList(const nsAString & id, const nsAString & version, PRUint32 type, PRBool includeDisabled, PRUint32 *itemCount, nsIUpdateItem ***items); \
  546.   NS_IMETHOD GetDatasource(nsIRDFDataSource * *aDatasource); \
  547.   NS_IMETHOD AddDownloads(nsIUpdateItem **items, PRUint32 itemCount, PRBool fromChrome); \
  548.   NS_IMETHOD RemoveDownload(const nsAString & url); \
  549.   NS_IMETHOD AddUpdateListener(nsIAddonUpdateListener *listener, PRInt32 *_retval); \
  550.   NS_IMETHOD RemoveUpdateListenerAt(PRInt32 index); \
  551.   NS_IMETHOD MoveToIndexOf(const nsAString & movingID, const nsAString & destinationID); 
  552.  
  553. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  554. #define NS_FORWARD_NSIEXTENSIONMANAGER(_to) \
  555.   NS_IMETHOD Start(nsICommandLine *commandLine, PRBool *_retval) { return _to Start(commandLine, _retval); } \
  556.   NS_IMETHOD CheckForMismatches(PRBool *_retval) { return _to CheckForMismatches(_retval); } \
  557.   NS_IMETHOD HandleCommandLineArgs(nsICommandLine *cmdline) { return _to HandleCommandLineArgs(cmdline); } \
  558.   NS_IMETHOD GetInstallLocation(const nsAString & id, nsIInstallLocation **_retval) { return _to GetInstallLocation(id, _retval); } \
  559.   NS_IMETHOD GetInstallLocations(nsISimpleEnumerator * *aInstallLocations) { return _to GetInstallLocations(aInstallLocations); } \
  560.   NS_IMETHOD InstallItemFromFile(nsIFile *xpiFile, const nsAString & installLocationKey) { return _to InstallItemFromFile(xpiFile, installLocationKey); } \
  561.   NS_IMETHOD UninstallItem(const nsAString & id) { return _to UninstallItem(id); } \
  562.   NS_IMETHOD EnableItem(const nsAString & id) { return _to EnableItem(id); } \
  563.   NS_IMETHOD DisableItem(const nsAString & id) { return _to DisableItem(id); } \
  564.   NS_IMETHOD Update(nsIUpdateItem **items, PRUint32 itemCount, PRUint32 versionUpdateOnly, nsIAddonUpdateCheckListener *listener) { return _to Update(items, itemCount, versionUpdateOnly, listener); } \
  565.   NS_IMETHOD GetItemForID(const nsAString & id, nsIUpdateItem **_retval) { return _to GetItemForID(id, _retval); } \
  566.   NS_IMETHOD GetItemList(PRUint32 type, PRUint32 *itemCount, nsIUpdateItem ***items) { return _to GetItemList(type, itemCount, items); } \
  567.   NS_IMETHOD GetIncompatibleItemList(const nsAString & id, const nsAString & version, PRUint32 type, PRBool includeDisabled, PRUint32 *itemCount, nsIUpdateItem ***items) { return _to GetIncompatibleItemList(id, version, type, includeDisabled, itemCount, items); } \
  568.   NS_IMETHOD GetDatasource(nsIRDFDataSource * *aDatasource) { return _to GetDatasource(aDatasource); } \
  569.   NS_IMETHOD AddDownloads(nsIUpdateItem **items, PRUint32 itemCount, PRBool fromChrome) { return _to AddDownloads(items, itemCount, fromChrome); } \
  570.   NS_IMETHOD RemoveDownload(const nsAString & url) { return _to RemoveDownload(url); } \
  571.   NS_IMETHOD AddUpdateListener(nsIAddonUpdateListener *listener, PRInt32 *_retval) { return _to AddUpdateListener(listener, _retval); } \
  572.   NS_IMETHOD RemoveUpdateListenerAt(PRInt32 index) { return _to RemoveUpdateListenerAt(index); } \
  573.   NS_IMETHOD MoveToIndexOf(const nsAString & movingID, const nsAString & destinationID) { return _to MoveToIndexOf(movingID, destinationID); } 
  574.  
  575. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  576. #define NS_FORWARD_SAFE_NSIEXTENSIONMANAGER(_to) \
  577.   NS_IMETHOD Start(nsICommandLine *commandLine, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Start(commandLine, _retval); } \
  578.   NS_IMETHOD CheckForMismatches(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CheckForMismatches(_retval); } \
  579.   NS_IMETHOD HandleCommandLineArgs(nsICommandLine *cmdline) { return !_to ? NS_ERROR_NULL_POINTER : _to->HandleCommandLineArgs(cmdline); } \
  580.   NS_IMETHOD GetInstallLocation(const nsAString & id, nsIInstallLocation **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetInstallLocation(id, _retval); } \
  581.   NS_IMETHOD GetInstallLocations(nsISimpleEnumerator * *aInstallLocations) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetInstallLocations(aInstallLocations); } \
  582.   NS_IMETHOD InstallItemFromFile(nsIFile *xpiFile, const nsAString & installLocationKey) { return !_to ? NS_ERROR_NULL_POINTER : _to->InstallItemFromFile(xpiFile, installLocationKey); } \
  583.   NS_IMETHOD UninstallItem(const nsAString & id) { return !_to ? NS_ERROR_NULL_POINTER : _to->UninstallItem(id); } \
  584.   NS_IMETHOD EnableItem(const nsAString & id) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnableItem(id); } \
  585.   NS_IMETHOD DisableItem(const nsAString & id) { return !_to ? NS_ERROR_NULL_POINTER : _to->DisableItem(id); } \
  586.   NS_IMETHOD Update(nsIUpdateItem **items, PRUint32 itemCount, PRUint32 versionUpdateOnly, nsIAddonUpdateCheckListener *listener) { return !_to ? NS_ERROR_NULL_POINTER : _to->Update(items, itemCount, versionUpdateOnly, listener); } \
  587.   NS_IMETHOD GetItemForID(const nsAString & id, nsIUpdateItem **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetItemForID(id, _retval); } \
  588.   NS_IMETHOD GetItemList(PRUint32 type, PRUint32 *itemCount, nsIUpdateItem ***items) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetItemList(type, itemCount, items); } \
  589.   NS_IMETHOD GetIncompatibleItemList(const nsAString & id, const nsAString & version, PRUint32 type, PRBool includeDisabled, PRUint32 *itemCount, nsIUpdateItem ***items) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIncompatibleItemList(id, version, type, includeDisabled, itemCount, items); } \
  590.   NS_IMETHOD GetDatasource(nsIRDFDataSource * *aDatasource) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDatasource(aDatasource); } \
  591.   NS_IMETHOD AddDownloads(nsIUpdateItem **items, PRUint32 itemCount, PRBool fromChrome) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddDownloads(items, itemCount, fromChrome); } \
  592.   NS_IMETHOD RemoveDownload(const nsAString & url) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveDownload(url); } \
  593.   NS_IMETHOD AddUpdateListener(nsIAddonUpdateListener *listener, PRInt32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddUpdateListener(listener, _retval); } \
  594.   NS_IMETHOD RemoveUpdateListenerAt(PRInt32 index) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveUpdateListenerAt(index); } \
  595.   NS_IMETHOD MoveToIndexOf(const nsAString & movingID, const nsAString & destinationID) { return !_to ? NS_ERROR_NULL_POINTER : _to->MoveToIndexOf(movingID, destinationID); } 
  596.  
  597. #if 0
  598. /* Use the code below as a template for the implementation class for this interface. */
  599.  
  600. /* Header file */
  601. class nsExtensionManager : public nsIExtensionManager
  602. {
  603. public:
  604.   NS_DECL_ISUPPORTS
  605.   NS_DECL_NSIEXTENSIONMANAGER
  606.  
  607.   nsExtensionManager();
  608.  
  609. private:
  610.   ~nsExtensionManager();
  611.  
  612. protected:
  613.   /* additional members */
  614. };
  615.  
  616. /* Implementation file */
  617. NS_IMPL_ISUPPORTS1(nsExtensionManager, nsIExtensionManager)
  618.  
  619. nsExtensionManager::nsExtensionManager()
  620. {
  621.   /* member initializers and constructor code */
  622. }
  623.  
  624. nsExtensionManager::~nsExtensionManager()
  625. {
  626.   /* destructor code */
  627. }
  628.  
  629. /* boolean start (in nsICommandLine commandLine); */
  630. NS_IMETHODIMP nsExtensionManager::Start(nsICommandLine *commandLine, PRBool *_retval)
  631. {
  632.     return NS_ERROR_NOT_IMPLEMENTED;
  633. }
  634.  
  635. /* boolean checkForMismatches (); */
  636. NS_IMETHODIMP nsExtensionManager::CheckForMismatches(PRBool *_retval)
  637. {
  638.     return NS_ERROR_NOT_IMPLEMENTED;
  639. }
  640.  
  641. /* void handleCommandLineArgs (in nsICommandLine cmdline); */
  642. NS_IMETHODIMP nsExtensionManager::HandleCommandLineArgs(nsICommandLine *cmdline)
  643. {
  644.     return NS_ERROR_NOT_IMPLEMENTED;
  645. }
  646.  
  647. /* nsIInstallLocation getInstallLocation (in AString id); */
  648. NS_IMETHODIMP nsExtensionManager::GetInstallLocation(const nsAString & id, nsIInstallLocation **_retval)
  649. {
  650.     return NS_ERROR_NOT_IMPLEMENTED;
  651. }
  652.  
  653. /* readonly attribute nsISimpleEnumerator installLocations; */
  654. NS_IMETHODIMP nsExtensionManager::GetInstallLocations(nsISimpleEnumerator * *aInstallLocations)
  655. {
  656.     return NS_ERROR_NOT_IMPLEMENTED;
  657. }
  658.  
  659. /* void installItemFromFile (in nsIFile xpiFile, in AString installLocationKey); */
  660. NS_IMETHODIMP nsExtensionManager::InstallItemFromFile(nsIFile *xpiFile, const nsAString & installLocationKey)
  661. {
  662.     return NS_ERROR_NOT_IMPLEMENTED;
  663. }
  664.  
  665. /* void uninstallItem (in AString id); */
  666. NS_IMETHODIMP nsExtensionManager::UninstallItem(const nsAString & id)
  667. {
  668.     return NS_ERROR_NOT_IMPLEMENTED;
  669. }
  670.  
  671. /* void enableItem (in AString id); */
  672. NS_IMETHODIMP nsExtensionManager::EnableItem(const nsAString & id)
  673. {
  674.     return NS_ERROR_NOT_IMPLEMENTED;
  675. }
  676.  
  677. /* void disableItem (in AString id); */
  678. NS_IMETHODIMP nsExtensionManager::DisableItem(const nsAString & id)
  679. {
  680.     return NS_ERROR_NOT_IMPLEMENTED;
  681. }
  682.  
  683. /* void update ([array, size_is (itemCount)] in nsIUpdateItem items, in unsigned long itemCount, in unsigned long versionUpdateOnly, in nsIAddonUpdateCheckListener listener); */
  684. NS_IMETHODIMP nsExtensionManager::Update(nsIUpdateItem **items, PRUint32 itemCount, PRUint32 versionUpdateOnly, nsIAddonUpdateCheckListener *listener)
  685. {
  686.     return NS_ERROR_NOT_IMPLEMENTED;
  687. }
  688.  
  689. /* nsIUpdateItem getItemForID (in AString id); */
  690. NS_IMETHODIMP nsExtensionManager::GetItemForID(const nsAString & id, nsIUpdateItem **_retval)
  691. {
  692.     return NS_ERROR_NOT_IMPLEMENTED;
  693. }
  694.  
  695. /* void getItemList (in unsigned long type, out unsigned long itemCount, [array, size_is (itemCount), retval] out nsIUpdateItem items); */
  696. NS_IMETHODIMP nsExtensionManager::GetItemList(PRUint32 type, PRUint32 *itemCount, nsIUpdateItem ***items)
  697. {
  698.     return NS_ERROR_NOT_IMPLEMENTED;
  699. }
  700.  
  701. /* void getIncompatibleItemList (in AString id, in AString version, in unsigned long type, in boolean includeDisabled, out unsigned long itemCount, [array, size_is (itemCount), retval] out nsIUpdateItem items); */
  702. NS_IMETHODIMP nsExtensionManager::GetIncompatibleItemList(const nsAString & id, const nsAString & version, PRUint32 type, PRBool includeDisabled, PRUint32 *itemCount, nsIUpdateItem ***items)
  703. {
  704.     return NS_ERROR_NOT_IMPLEMENTED;
  705. }
  706.  
  707. /* readonly attribute nsIRDFDataSource datasource; */
  708. NS_IMETHODIMP nsExtensionManager::GetDatasource(nsIRDFDataSource * *aDatasource)
  709. {
  710.     return NS_ERROR_NOT_IMPLEMENTED;
  711. }
  712.  
  713. /* void addDownloads ([array, size_is (itemCount)] in nsIUpdateItem items, in unsigned long itemCount, in boolean fromChrome); */
  714. NS_IMETHODIMP nsExtensionManager::AddDownloads(nsIUpdateItem **items, PRUint32 itemCount, PRBool fromChrome)
  715. {
  716.     return NS_ERROR_NOT_IMPLEMENTED;
  717. }
  718.  
  719. /* void removeDownload (in AString url); */
  720. NS_IMETHODIMP nsExtensionManager::RemoveDownload(const nsAString & url)
  721. {
  722.     return NS_ERROR_NOT_IMPLEMENTED;
  723. }
  724.  
  725. /* long addUpdateListener (in nsIAddonUpdateListener listener); */
  726. NS_IMETHODIMP nsExtensionManager::AddUpdateListener(nsIAddonUpdateListener *listener, PRInt32 *_retval)
  727. {
  728.     return NS_ERROR_NOT_IMPLEMENTED;
  729. }
  730.  
  731. /* void removeUpdateListenerAt (in long index); */
  732. NS_IMETHODIMP nsExtensionManager::RemoveUpdateListenerAt(PRInt32 index)
  733. {
  734.     return NS_ERROR_NOT_IMPLEMENTED;
  735. }
  736.  
  737. /* void moveToIndexOf (in AString movingID, in AString destinationID); */
  738. NS_IMETHODIMP nsExtensionManager::MoveToIndexOf(const nsAString & movingID, const nsAString & destinationID)
  739. {
  740.     return NS_ERROR_NOT_IMPLEMENTED;
  741. }
  742.  
  743. /* End of implementation class template. */
  744. #endif
  745.  
  746.  
  747. /* starting interface:    nsIUpdateItem */
  748. #define NS_IUPDATEITEM_IID_STR "7f952767-427f-402b-8114-f80c95d1980d"
  749.  
  750. #define NS_IUPDATEITEM_IID \
  751.   {0x7f952767, 0x427f, 0x402b, \
  752.     { 0x81, 0x14, 0xf8, 0x0c, 0x95, 0xd1, 0x98, 0x0d }}
  753.  
  754. class NS_NO_VTABLE nsIUpdateItem : public nsISupports {
  755.  public: 
  756.  
  757.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IUPDATEITEM_IID)
  758.  
  759.   /**
  760.  * An item managed by the Extension System. Contains metadata that describes 
  761.  * the item.
  762.  * XXXben work in progress, the name of this interface will change after the
  763.  *        update system is complete, probably to nsIAddon
  764.  */
  765. /**
  766.    * The GUID of the item.
  767.    */
  768.   /* readonly attribute AString id; */
  769.   NS_IMETHOD GetId(nsAString & aId) = 0;
  770.  
  771.   /**
  772.    * The Version of the item, in FVF format.
  773.    */
  774.   /* readonly attribute AString version; */
  775.   NS_IMETHOD GetVersion(nsAString & aVersion) = 0;
  776.  
  777.   /**
  778.    * The minimum version of the application that this item works with, 
  779.    * in FVF format.
  780.    */
  781.   /* readonly attribute AString minAppVersion; */
  782.   NS_IMETHOD GetMinAppVersion(nsAString & aMinAppVersion) = 0;
  783.  
  784.   /**
  785.    * The maximum version of the application that this item works with,
  786.    * in FVF format.
  787.    */
  788.   /* readonly attribute AString maxAppVersion; */
  789.   NS_IMETHOD GetMaxAppVersion(nsAString & aMaxAppVersion) = 0;
  790.  
  791.   /**
  792.    * The name of the Install Location where this item is installed.
  793.    */
  794.   /* readonly attribute AString installLocationKey; */
  795.   NS_IMETHOD GetInstallLocationKey(nsAString & aInstallLocationKey) = 0;
  796.  
  797.   /**
  798.    * The name of this item.
  799.    */
  800.   /* readonly attribute AString name; */
  801.   NS_IMETHOD GetName(nsAString & aName) = 0;
  802.  
  803.   /**
  804.    * The URL of the XPI where this item can be downloaded.
  805.    */
  806.   /* readonly attribute AString xpiURL; */
  807.   NS_IMETHOD GetXpiURL(nsAString & aXpiURL) = 0;
  808.  
  809.   /**
  810.    * The string Hash for the XPI file. Can be null and if supplied must be in
  811.    * the format of "type:hash" (see the types in nsICryptoHash and
  812.    * nsIXPInstallManager::initManagerWithHashes).
  813.    */
  814.   /* readonly attribute AString xpiHash; */
  815.   NS_IMETHOD GetXpiHash(nsAString & aXpiHash) = 0;
  816.  
  817.   /**
  818.    * The URL of the icon that can be shown for this item.
  819.    */
  820.   /* readonly attribute AString iconURL; */
  821.   NS_IMETHOD GetIconURL(nsAString & aIconURL) = 0;
  822.  
  823.   /**
  824.    * The URL of the update RDF file for this item.
  825.    */
  826.   /* readonly attribute AString updateRDF; */
  827.   NS_IMETHOD GetUpdateRDF(nsAString & aUpdateRDF) = 0;
  828.  
  829.   enum { TYPE_APP = 1U };
  830.  
  831.   enum { TYPE_EXTENSION = 2U };
  832.  
  833.   enum { TYPE_THEME = 4U };
  834.  
  835.   enum { TYPE_LOCALE = 8U };
  836.  
  837.   enum { TYPE_PLUGIN = 16U };
  838.  
  839.   enum { TYPE_MULTI_XPI = 32U };
  840.  
  841.   enum { TYPE_ADDON = 30U };
  842.  
  843.   enum { TYPE_ANY = 31U };
  844.  
  845.   /**
  846.    * The type of this item.
  847.    */
  848.   /* readonly attribute long type; */
  849.   NS_IMETHOD GetType(PRInt32 *aType) = 0;
  850.  
  851.   /**
  852.    * Initializes this Item object.
  853.    */
  854.   /* void init (in AString id, in AString version, in AString installLocationKey, in AString minAppVersion, in AString maxAppVersion, in AString name, in AString downloadURL, in AString xpiHash, in AString iconURL, in AString updateURL, in long type); */
  855.   NS_IMETHOD Init(const nsAString & id, const nsAString & version, const nsAString & installLocationKey, const nsAString & minAppVersion, const nsAString & maxAppVersion, const nsAString & name, const nsAString & downloadURL, const nsAString & xpiHash, const nsAString & iconURL, const nsAString & updateURL, PRInt32 type) = 0;
  856.  
  857.   /**
  858.    * Returns a JS Object source representing an nsIUpdateItem.
  859.    */
  860.   /* readonly attribute AString objectSource; */
  861.   NS_IMETHOD GetObjectSource(nsAString & aObjectSource) = 0;
  862.  
  863. };
  864.  
  865. /* Use this macro when declaring classes that implement this interface. */
  866. #define NS_DECL_NSIUPDATEITEM \
  867.   NS_IMETHOD GetId(nsAString & aId); \
  868.   NS_IMETHOD GetVersion(nsAString & aVersion); \
  869.   NS_IMETHOD GetMinAppVersion(nsAString & aMinAppVersion); \
  870.   NS_IMETHOD GetMaxAppVersion(nsAString & aMaxAppVersion); \
  871.   NS_IMETHOD GetInstallLocationKey(nsAString & aInstallLocationKey); \
  872.   NS_IMETHOD GetName(nsAString & aName); \
  873.   NS_IMETHOD GetXpiURL(nsAString & aXpiURL); \
  874.   NS_IMETHOD GetXpiHash(nsAString & aXpiHash); \
  875.   NS_IMETHOD GetIconURL(nsAString & aIconURL); \
  876.   NS_IMETHOD GetUpdateRDF(nsAString & aUpdateRDF); \
  877.   NS_IMETHOD GetType(PRInt32 *aType); \
  878.   NS_IMETHOD Init(const nsAString & id, const nsAString & version, const nsAString & installLocationKey, const nsAString & minAppVersion, const nsAString & maxAppVersion, const nsAString & name, const nsAString & downloadURL, const nsAString & xpiHash, const nsAString & iconURL, const nsAString & updateURL, PRInt32 type); \
  879.   NS_IMETHOD GetObjectSource(nsAString & aObjectSource); 
  880.  
  881. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  882. #define NS_FORWARD_NSIUPDATEITEM(_to) \
  883.   NS_IMETHOD GetId(nsAString & aId) { return _to GetId(aId); } \
  884.   NS_IMETHOD GetVersion(nsAString & aVersion) { return _to GetVersion(aVersion); } \
  885.   NS_IMETHOD GetMinAppVersion(nsAString & aMinAppVersion) { return _to GetMinAppVersion(aMinAppVersion); } \
  886.   NS_IMETHOD GetMaxAppVersion(nsAString & aMaxAppVersion) { return _to GetMaxAppVersion(aMaxAppVersion); } \
  887.   NS_IMETHOD GetInstallLocationKey(nsAString & aInstallLocationKey) { return _to GetInstallLocationKey(aInstallLocationKey); } \
  888.   NS_IMETHOD GetName(nsAString & aName) { return _to GetName(aName); } \
  889.   NS_IMETHOD GetXpiURL(nsAString & aXpiURL) { return _to GetXpiURL(aXpiURL); } \
  890.   NS_IMETHOD GetXpiHash(nsAString & aXpiHash) { return _to GetXpiHash(aXpiHash); } \
  891.   NS_IMETHOD GetIconURL(nsAString & aIconURL) { return _to GetIconURL(aIconURL); } \
  892.   NS_IMETHOD GetUpdateRDF(nsAString & aUpdateRDF) { return _to GetUpdateRDF(aUpdateRDF); } \
  893.   NS_IMETHOD GetType(PRInt32 *aType) { return _to GetType(aType); } \
  894.   NS_IMETHOD Init(const nsAString & id, const nsAString & version, const nsAString & installLocationKey, const nsAString & minAppVersion, const nsAString & maxAppVersion, const nsAString & name, const nsAString & downloadURL, const nsAString & xpiHash, const nsAString & iconURL, const nsAString & updateURL, PRInt32 type) { return _to Init(id, version, installLocationKey, minAppVersion, maxAppVersion, name, downloadURL, xpiHash, iconURL, updateURL, type); } \
  895.   NS_IMETHOD GetObjectSource(nsAString & aObjectSource) { return _to GetObjectSource(aObjectSource); } 
  896.  
  897. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  898. #define NS_FORWARD_SAFE_NSIUPDATEITEM(_to) \
  899.   NS_IMETHOD GetId(nsAString & aId) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetId(aId); } \
  900.   NS_IMETHOD GetVersion(nsAString & aVersion) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetVersion(aVersion); } \
  901.   NS_IMETHOD GetMinAppVersion(nsAString & aMinAppVersion) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetMinAppVersion(aMinAppVersion); } \
  902.   NS_IMETHOD GetMaxAppVersion(nsAString & aMaxAppVersion) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetMaxAppVersion(aMaxAppVersion); } \
  903.   NS_IMETHOD GetInstallLocationKey(nsAString & aInstallLocationKey) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetInstallLocationKey(aInstallLocationKey); } \
  904.   NS_IMETHOD GetName(nsAString & aName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetName(aName); } \
  905.   NS_IMETHOD GetXpiURL(nsAString & aXpiURL) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetXpiURL(aXpiURL); } \
  906.   NS_IMETHOD GetXpiHash(nsAString & aXpiHash) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetXpiHash(aXpiHash); } \
  907.   NS_IMETHOD GetIconURL(nsAString & aIconURL) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIconURL(aIconURL); } \
  908.   NS_IMETHOD GetUpdateRDF(nsAString & aUpdateRDF) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUpdateRDF(aUpdateRDF); } \
  909.   NS_IMETHOD GetType(PRInt32 *aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetType(aType); } \
  910.   NS_IMETHOD Init(const nsAString & id, const nsAString & version, const nsAString & installLocationKey, const nsAString & minAppVersion, const nsAString & maxAppVersion, const nsAString & name, const nsAString & downloadURL, const nsAString & xpiHash, const nsAString & iconURL, const nsAString & updateURL, PRInt32 type) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(id, version, installLocationKey, minAppVersion, maxAppVersion, name, downloadURL, xpiHash, iconURL, updateURL, type); } \
  911.   NS_IMETHOD GetObjectSource(nsAString & aObjectSource) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetObjectSource(aObjectSource); } 
  912.  
  913. #if 0
  914. /* Use the code below as a template for the implementation class for this interface. */
  915.  
  916. /* Header file */
  917. class nsUpdateItem : public nsIUpdateItem
  918. {
  919. public:
  920.   NS_DECL_ISUPPORTS
  921.   NS_DECL_NSIUPDATEITEM
  922.  
  923.   nsUpdateItem();
  924.  
  925. private:
  926.   ~nsUpdateItem();
  927.  
  928. protected:
  929.   /* additional members */
  930. };
  931.  
  932. /* Implementation file */
  933. NS_IMPL_ISUPPORTS1(nsUpdateItem, nsIUpdateItem)
  934.  
  935. nsUpdateItem::nsUpdateItem()
  936. {
  937.   /* member initializers and constructor code */
  938. }
  939.  
  940. nsUpdateItem::~nsUpdateItem()
  941. {
  942.   /* destructor code */
  943. }
  944.  
  945. /* readonly attribute AString id; */
  946. NS_IMETHODIMP nsUpdateItem::GetId(nsAString & aId)
  947. {
  948.     return NS_ERROR_NOT_IMPLEMENTED;
  949. }
  950.  
  951. /* readonly attribute AString version; */
  952. NS_IMETHODIMP nsUpdateItem::GetVersion(nsAString & aVersion)
  953. {
  954.     return NS_ERROR_NOT_IMPLEMENTED;
  955. }
  956.  
  957. /* readonly attribute AString minAppVersion; */
  958. NS_IMETHODIMP nsUpdateItem::GetMinAppVersion(nsAString & aMinAppVersion)
  959. {
  960.     return NS_ERROR_NOT_IMPLEMENTED;
  961. }
  962.  
  963. /* readonly attribute AString maxAppVersion; */
  964. NS_IMETHODIMP nsUpdateItem::GetMaxAppVersion(nsAString & aMaxAppVersion)
  965. {
  966.     return NS_ERROR_NOT_IMPLEMENTED;
  967. }
  968.  
  969. /* readonly attribute AString installLocationKey; */
  970. NS_IMETHODIMP nsUpdateItem::GetInstallLocationKey(nsAString & aInstallLocationKey)
  971. {
  972.     return NS_ERROR_NOT_IMPLEMENTED;
  973. }
  974.  
  975. /* readonly attribute AString name; */
  976. NS_IMETHODIMP nsUpdateItem::GetName(nsAString & aName)
  977. {
  978.     return NS_ERROR_NOT_IMPLEMENTED;
  979. }
  980.  
  981. /* readonly attribute AString xpiURL; */
  982. NS_IMETHODIMP nsUpdateItem::GetXpiURL(nsAString & aXpiURL)
  983. {
  984.     return NS_ERROR_NOT_IMPLEMENTED;
  985. }
  986.  
  987. /* readonly attribute AString xpiHash; */
  988. NS_IMETHODIMP nsUpdateItem::GetXpiHash(nsAString & aXpiHash)
  989. {
  990.     return NS_ERROR_NOT_IMPLEMENTED;
  991. }
  992.  
  993. /* readonly attribute AString iconURL; */
  994. NS_IMETHODIMP nsUpdateItem::GetIconURL(nsAString & aIconURL)
  995. {
  996.     return NS_ERROR_NOT_IMPLEMENTED;
  997. }
  998.  
  999. /* readonly attribute AString updateRDF; */
  1000. NS_IMETHODIMP nsUpdateItem::GetUpdateRDF(nsAString & aUpdateRDF)
  1001. {
  1002.     return NS_ERROR_NOT_IMPLEMENTED;
  1003. }
  1004.  
  1005. /* readonly attribute long type; */
  1006. NS_IMETHODIMP nsUpdateItem::GetType(PRInt32 *aType)
  1007. {
  1008.     return NS_ERROR_NOT_IMPLEMENTED;
  1009. }
  1010.  
  1011. /* void init (in AString id, in AString version, in AString installLocationKey, in AString minAppVersion, in AString maxAppVersion, in AString name, in AString downloadURL, in AString xpiHash, in AString iconURL, in AString updateURL, in long type); */
  1012. NS_IMETHODIMP nsUpdateItem::Init(const nsAString & id, const nsAString & version, const nsAString & installLocationKey, const nsAString & minAppVersion, const nsAString & maxAppVersion, const nsAString & name, const nsAString & downloadURL, const nsAString & xpiHash, const nsAString & iconURL, const nsAString & updateURL, PRInt32 type)
  1013. {
  1014.     return NS_ERROR_NOT_IMPLEMENTED;
  1015. }
  1016.  
  1017. /* readonly attribute AString objectSource; */
  1018. NS_IMETHODIMP nsUpdateItem::GetObjectSource(nsAString & aObjectSource)
  1019. {
  1020.     return NS_ERROR_NOT_IMPLEMENTED;
  1021. }
  1022.  
  1023. /* End of implementation class template. */
  1024. #endif
  1025.  
  1026.  
  1027. /* starting interface:    nsIAddonUpdateListener */
  1028. #define NS_IADDONUPDATELISTENER_IID_STR "bb86037c-98c1-4c22-8e03-1e4c9fc89a8e"
  1029.  
  1030. #define NS_IADDONUPDATELISTENER_IID \
  1031.   {0xbb86037c, 0x98c1, 0x4c22, \
  1032.     { 0x8e, 0x03, 0x1e, 0x4c, 0x9f, 0xc8, 0x9a, 0x8e }}
  1033.  
  1034. class NS_NO_VTABLE nsIAddonUpdateListener : public nsISupports {
  1035.  public: 
  1036.  
  1037.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IADDONUPDATELISTENER_IID)
  1038.  
  1039.   /**
  1040.  * Interface for handling download and install progress notifications for 
  1041.  * addons.
  1042.  */
  1043. /**
  1044.    * Install/Download state has changed
  1045.    * @param   addon
  1046.    *          The addon that state changed for
  1047.    * @param   state
  1048.    *          The new state. States are defined in nsIXPIProgressDialog
  1049.    * @param   value
  1050.    *          Some data about the new state
  1051.    */
  1052.   /* void onStateChange (in nsIUpdateItem addon, in short state, in long value); */
  1053.   NS_IMETHOD OnStateChange(nsIUpdateItem *addon, PRInt16 state, PRInt32 value) = 0;
  1054.  
  1055.   /**
  1056.    * Progress occurred in the download/install operation
  1057.    * @param   addon
  1058.    *          The addon that progress occurred for
  1059.    * @param   value
  1060.    *          The value of the current progress
  1061.    * @param   maxValue
  1062.    *          The maximum value |value| can reach
  1063.    */
  1064.   /* void onProgress (in nsIUpdateItem addon, in unsigned long value, in unsigned long maxValue); */
  1065.   NS_IMETHOD OnProgress(nsIUpdateItem *addon, PRUint32 value, PRUint32 maxValue) = 0;
  1066.  
  1067. };
  1068.  
  1069. /* Use this macro when declaring classes that implement this interface. */
  1070. #define NS_DECL_NSIADDONUPDATELISTENER \
  1071.   NS_IMETHOD OnStateChange(nsIUpdateItem *addon, PRInt16 state, PRInt32 value); \
  1072.   NS_IMETHOD OnProgress(nsIUpdateItem *addon, PRUint32 value, PRUint32 maxValue); 
  1073.  
  1074. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  1075. #define NS_FORWARD_NSIADDONUPDATELISTENER(_to) \
  1076.   NS_IMETHOD OnStateChange(nsIUpdateItem *addon, PRInt16 state, PRInt32 value) { return _to OnStateChange(addon, state, value); } \
  1077.   NS_IMETHOD OnProgress(nsIUpdateItem *addon, PRUint32 value, PRUint32 maxValue) { return _to OnProgress(addon, value, maxValue); } 
  1078.  
  1079. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  1080. #define NS_FORWARD_SAFE_NSIADDONUPDATELISTENER(_to) \
  1081.   NS_IMETHOD OnStateChange(nsIUpdateItem *addon, PRInt16 state, PRInt32 value) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnStateChange(addon, state, value); } \
  1082.   NS_IMETHOD OnProgress(nsIUpdateItem *addon, PRUint32 value, PRUint32 maxValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnProgress(addon, value, maxValue); } 
  1083.  
  1084. #if 0
  1085. /* Use the code below as a template for the implementation class for this interface. */
  1086.  
  1087. /* Header file */
  1088. class nsAddonUpdateListener : public nsIAddonUpdateListener
  1089. {
  1090. public:
  1091.   NS_DECL_ISUPPORTS
  1092.   NS_DECL_NSIADDONUPDATELISTENER
  1093.  
  1094.   nsAddonUpdateListener();
  1095.  
  1096. private:
  1097.   ~nsAddonUpdateListener();
  1098.  
  1099. protected:
  1100.   /* additional members */
  1101. };
  1102.  
  1103. /* Implementation file */
  1104. NS_IMPL_ISUPPORTS1(nsAddonUpdateListener, nsIAddonUpdateListener)
  1105.  
  1106. nsAddonUpdateListener::nsAddonUpdateListener()
  1107. {
  1108.   /* member initializers and constructor code */
  1109. }
  1110.  
  1111. nsAddonUpdateListener::~nsAddonUpdateListener()
  1112. {
  1113.   /* destructor code */
  1114. }
  1115.  
  1116. /* void onStateChange (in nsIUpdateItem addon, in short state, in long value); */
  1117. NS_IMETHODIMP nsAddonUpdateListener::OnStateChange(nsIUpdateItem *addon, PRInt16 state, PRInt32 value)
  1118. {
  1119.     return NS_ERROR_NOT_IMPLEMENTED;
  1120. }
  1121.  
  1122. /* void onProgress (in nsIUpdateItem addon, in unsigned long value, in unsigned long maxValue); */
  1123. NS_IMETHODIMP nsAddonUpdateListener::OnProgress(nsIUpdateItem *addon, PRUint32 value, PRUint32 maxValue)
  1124. {
  1125.     return NS_ERROR_NOT_IMPLEMENTED;
  1126. }
  1127.  
  1128. /* End of implementation class template. */
  1129. #endif
  1130.  
  1131.  
  1132. /* starting interface:    nsIAddonUpdateCheckListener */
  1133. #define NS_IADDONUPDATECHECKLISTENER_IID_STR "c946119f-9e7c-41aa-a794-803148045350"
  1134.  
  1135. #define NS_IADDONUPDATECHECKLISTENER_IID \
  1136.   {0xc946119f, 0x9e7c, 0x41aa, \
  1137.     { 0xa7, 0x94, 0x80, 0x31, 0x48, 0x04, 0x53, 0x50 }}
  1138.  
  1139. class NS_NO_VTABLE nsIAddonUpdateCheckListener : public nsISupports {
  1140.  public: 
  1141.  
  1142.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IADDONUPDATECHECKLISTENER_IID)
  1143.  
  1144.   /**
  1145.  * Interface for handling notifications during the addon update check process.
  1146.  */
  1147. /**
  1148.    * Addon update has begun
  1149.    */
  1150.   /* void onUpdateStarted (); */
  1151.   NS_IMETHOD OnUpdateStarted(void) = 0;
  1152.  
  1153.   enum { STATUS_NONE = 0U };
  1154.  
  1155.   enum { STATUS_UPDATE = 1U };
  1156.  
  1157.   enum { STATUS_VERSIONINFO = 2U };
  1158.  
  1159.   enum { STATUS_DATA_FOUND = 3U };
  1160.  
  1161.   enum { STATUS_FAILURE = 4U };
  1162.  
  1163.   enum { STATUS_NO_UPDATE = 8U };
  1164.  
  1165.   enum { STATUS_DISABLED = 16U };
  1166.  
  1167.   enum { STATUS_APP_MANAGED = 32U };
  1168.  
  1169.   enum { STATUS_READ_ONLY = 64U };
  1170.  
  1171.   enum { STATUS_PENDING_OP = 128U };
  1172.  
  1173.   enum { STATUS_NOT_MANAGED = 256U };
  1174.  
  1175.   enum { STATUS_DISALLOWED = 496U };
  1176.  
  1177.   /**
  1178.    * Addon update has ended
  1179.    */
  1180.   /* void onUpdateEnded (); */
  1181.   NS_IMETHOD OnUpdateEnded(void) = 0;
  1182.  
  1183.   /**
  1184.    * Update for an individual addon has begun
  1185.    * @param   addon
  1186.    *          A nsIUpdateItem object representing the addon being updated
  1187.    */
  1188.   /* void onAddonUpdateStarted (in nsIUpdateItem addon); */
  1189.   NS_IMETHOD OnAddonUpdateStarted(nsIUpdateItem *addon) = 0;
  1190.  
  1191.   /**
  1192.    * Update for an individual addon has ended
  1193.    * @param   addon
  1194.    *          A nsIUpdateItem object representing the addon being updated
  1195.    * @param   status
  1196.    *          The success or failure code of the update operation
  1197.    */
  1198.   /* void onAddonUpdateEnded (in nsIUpdateItem addon, in long status); */
  1199.   NS_IMETHOD OnAddonUpdateEnded(nsIUpdateItem *addon, PRInt32 status) = 0;
  1200.  
  1201. };
  1202.  
  1203. /* Use this macro when declaring classes that implement this interface. */
  1204. #define NS_DECL_NSIADDONUPDATECHECKLISTENER \
  1205.   NS_IMETHOD OnUpdateStarted(void); \
  1206.   NS_IMETHOD OnUpdateEnded(void); \
  1207.   NS_IMETHOD OnAddonUpdateStarted(nsIUpdateItem *addon); \
  1208.   NS_IMETHOD OnAddonUpdateEnded(nsIUpdateItem *addon, PRInt32 status); 
  1209.  
  1210. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  1211. #define NS_FORWARD_NSIADDONUPDATECHECKLISTENER(_to) \
  1212.   NS_IMETHOD OnUpdateStarted(void) { return _to OnUpdateStarted(); } \
  1213.   NS_IMETHOD OnUpdateEnded(void) { return _to OnUpdateEnded(); } \
  1214.   NS_IMETHOD OnAddonUpdateStarted(nsIUpdateItem *addon) { return _to OnAddonUpdateStarted(addon); } \
  1215.   NS_IMETHOD OnAddonUpdateEnded(nsIUpdateItem *addon, PRInt32 status) { return _to OnAddonUpdateEnded(addon, status); } 
  1216.  
  1217. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  1218. #define NS_FORWARD_SAFE_NSIADDONUPDATECHECKLISTENER(_to) \
  1219.   NS_IMETHOD OnUpdateStarted(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnUpdateStarted(); } \
  1220.   NS_IMETHOD OnUpdateEnded(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnUpdateEnded(); } \
  1221.   NS_IMETHOD OnAddonUpdateStarted(nsIUpdateItem *addon) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnAddonUpdateStarted(addon); } \
  1222.   NS_IMETHOD OnAddonUpdateEnded(nsIUpdateItem *addon, PRInt32 status) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnAddonUpdateEnded(addon, status); } 
  1223.  
  1224. #if 0
  1225. /* Use the code below as a template for the implementation class for this interface. */
  1226.  
  1227. /* Header file */
  1228. class nsAddonUpdateCheckListener : public nsIAddonUpdateCheckListener
  1229. {
  1230. public:
  1231.   NS_DECL_ISUPPORTS
  1232.   NS_DECL_NSIADDONUPDATECHECKLISTENER
  1233.  
  1234.   nsAddonUpdateCheckListener();
  1235.  
  1236. private:
  1237.   ~nsAddonUpdateCheckListener();
  1238.  
  1239. protected:
  1240.   /* additional members */
  1241. };
  1242.  
  1243. /* Implementation file */
  1244. NS_IMPL_ISUPPORTS1(nsAddonUpdateCheckListener, nsIAddonUpdateCheckListener)
  1245.  
  1246. nsAddonUpdateCheckListener::nsAddonUpdateCheckListener()
  1247. {
  1248.   /* member initializers and constructor code */
  1249. }
  1250.  
  1251. nsAddonUpdateCheckListener::~nsAddonUpdateCheckListener()
  1252. {
  1253.   /* destructor code */
  1254. }
  1255.  
  1256. /* void onUpdateStarted (); */
  1257. NS_IMETHODIMP nsAddonUpdateCheckListener::OnUpdateStarted()
  1258. {
  1259.     return NS_ERROR_NOT_IMPLEMENTED;
  1260. }
  1261.  
  1262. /* void onUpdateEnded (); */
  1263. NS_IMETHODIMP nsAddonUpdateCheckListener::OnUpdateEnded()
  1264. {
  1265.     return NS_ERROR_NOT_IMPLEMENTED;
  1266. }
  1267.  
  1268. /* void onAddonUpdateStarted (in nsIUpdateItem addon); */
  1269. NS_IMETHODIMP nsAddonUpdateCheckListener::OnAddonUpdateStarted(nsIUpdateItem *addon)
  1270. {
  1271.     return NS_ERROR_NOT_IMPLEMENTED;
  1272. }
  1273.  
  1274. /* void onAddonUpdateEnded (in nsIUpdateItem addon, in long status); */
  1275. NS_IMETHODIMP nsAddonUpdateCheckListener::OnAddonUpdateEnded(nsIUpdateItem *addon, PRInt32 status)
  1276. {
  1277.     return NS_ERROR_NOT_IMPLEMENTED;
  1278. }
  1279.  
  1280. /* End of implementation class template. */
  1281. #endif
  1282.  
  1283. /**
  1284.  * Install Location Key for Application-Global Items
  1285.  */
  1286. #define NS_INSTALL_LOCATION_APPGLOBAL NS_LITERAL_STRING("app-global")
  1287. /**
  1288.  * Install Location Key for Application-Profile Items
  1289.  */
  1290. #define NS_INSTALL_LOCATION_APPPROFILE NS_LITERAL_STRING("app-profile")
  1291. /** 
  1292.  * The category that contains a list of contract-ids to Install Location 
  1293.  * services.
  1294.  */
  1295. #define CATEGORY_INSTALL_LOCATIONS "extension-install-locations"
  1296. /**
  1297.  * The observer topic to listen to for actions performed on installed
  1298.  * items.
  1299.  */
  1300. #define EM_ACTION_REQUESTED_TOPIC "em-action-requested"
  1301. #define EM_ITEM_INSTALLED   "item-installed"
  1302. #define EM_ITEM_UPGRADED    "item-upgraded"
  1303. #define EM_ITEM_UNINSTALLED "item-uninstalled"
  1304. #define EM_ITEM_ENABLED     "item-enabled"
  1305. #define EM_ITEM_DISABLED    "item-disabled"
  1306. #define EM_ITEM_CANCEL      "item-cancel-action"
  1307.  
  1308. #endif /* __gen_nsIExtensionManager_h__ */
  1309.